package com.yidu.hbatsft.action;

import com.yidu.hbatsft.domain.AtsScheme;
import com.yidu.hbatsft.domain.AtsSchemeAudit;
import com.yidu.hbatsft.service.AtsSchemeAuditService;
import com.yidu.hbatsft.service.MentalityAtsSchemeAuditService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
  *@ClassName MentalityAtsSchemeAuditController
  *@Description 方案审核控制类
  *@Author 肖瑜
  *@Date 2020/1/9 9:54
  *@Version 1.0
**/
@Controller
@RequestMapping("/menAudit")
public class MentalityAtsSchemeAuditController {

    //方案审核service
    @Resource
    MentalityAtsSchemeAuditService menAtsSchemeAuditService;

    /**
     * 查询所有审核
     * @param pageNum 页数
     * @param pageSize 条数
     * @param audit 审核对象
     * @return map 集合
     */
    @ResponseBody
    @RequestMapping("findAll")
    public Map<String, Object> findAll(@RequestParam("page") Integer pageNum, @RequestParam("limit") Integer pageSize,AtsSchemeAudit audit) {
        //创建map集合
        Map<String, Object> map = new HashMap<String, Object>();
        //调用查询所有审核方法
        List<AtsSchemeAudit> allAudit = menAtsSchemeAuditService.findAllAudit(pageNum, pageSize,audit);
        //将code设置为0
        map.put("code", 0);
        //将msg设置为空
        map.put("msg", "");
        //统计条数放入map
        map.put("count", menAtsSchemeAuditService.count(audit));
        //将集合放入map
        map.put("data", allAudit);
        //返回map
        return map;
    }
}
